from public.tools import *
from public.action import *
from public.testDATE import *

from selenium.webdriver.common.keys import Keys

#新知识：使用Y轴兄弟定位following-sibling::
testCase="DBshop007_销售管理查看发货单"
rootpath=get_pro_rootpath()
filepath=rootpath+r"\public\ZCdh.txt"
orderID=readFile(filepath)

# "1.点击销售管理发货单。
firefox=openB(adminurl)
adminlogin(firefox)
menu2(firefox,"销售管理","发货单")

# 2.点击“查看”按钮，可以查看发货单已发货和未发货信息。"
firefox.find_element_by_xpath("//td[text()='%s']/following-sibling::td[5]/a"%orderID).click()
time.sleep(4)
s=firefox.find_element_by_xpath("//body").text
l="订单号"+orderID+"  "
r="\)"
aa=reGetString(s,l,r)
print(aa)
yuqi="已收货"
time.sleep(2)
if yuqi==aa:
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)

firefox.quit()